﻿<MContainer Fluid>
    <MCheckbox @bind-Value="_custom"
               Label="Custom progress bar">
    </MCheckbox>

    @{
        var customProgressLinear
            = _custom ? @<MProgressLinear Value="@ProgressValue"
                                          Color="@Color"
                                          Absolute
                                          Height="7">
                        </MProgressLinear>
                      : (RenderFragment?)null;
    }

    <MTextField @bind-Value="_value"
                Color="cyan darken"
                Label="Text field"
                Placeholder="Start typing..."
                Loading="true"
                ProgressContent="customProgressLinear">
    </MTextField>
</MContainer>

@code {

    private string _value = "";
    private bool _custom = true;

    private double ProgressValue => Math.Min(100, _value.Length * 10);

    private string Color => new[] { "error", "warning", "success" }[Convert.ToInt32(Math.Floor(ProgressValue / 40))];

}
